package com.rbac.web.model;

import java.util.Arrays;
import lombok.Getter;

/**
 * @author gengaoliu
 */
@Getter
public enum PermissionType {
  /** 权限类型 */
  BUTTON("button"),
  MENU("menu");
  private final String value;

  PermissionType(String value) {
    this.value = value;
  }

  public static PermissionType getByValue(String value) {
    return Arrays.stream(PermissionType.values())
        .filter(type -> type.getValue().equals(value.toLowerCase()))
        .findFirst()
        .orElse(null);
  }
}
